import { http } from '@/utils/request-generator'
import type { AxiosResponse } from 'axios'

export interface TableInfo {
  tableName: string
  tableComment: string
  generatedAt?: string
}

export interface GenerateReq {
  tableName: string
  force?: boolean
}

export const generatorApi = {
  listTables(keyword?: string): Promise<AxiosResponse<TableInfo[]>> {
    return http.get('tables', { keyword })
  },
  generate(data: GenerateReq): Promise<AxiosResponse<any>> {
    return http.post('generate', data)
  }
}

export default generatorApi


